<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="../../../../src/css/common/reset.css">
    <link rel="stylesheet" href="com-switch.css">
    <script src="../../lib/jquery.js"></script>
    <script src="com-switch.js"></script>
</head>
<style>
    .demo{
        width:800px;
        min-height: 400px;
        margin:0 auto;
        padding:10px;
        border: 1px solid #ebebeb;
    }
</style>
<body>

<div class="demo clearfix">


    <section data-name="comSwitch" class="com-switch">
        <label class="">
            <i data-name="checkStyle" class="com-style"></i>
            <input type="checkbox" value="小红">
        </label>
    </section>
    <section data-name="comSwitch" class="com-switch">
        <label class="">
            <i data-name="checkStyle" class="com-style"></i>
            <input type="checkbox" value="小红2">
        </label>
    </section>

    <section data-name="comSwitch" class="com-switch">
        <label class="">
            <i data-name="checkStyle" class="com-style"></i>
            <input type="checkbox" value="小红3">
        </label>
    </section>




    <input class="mt20" type="button" value="点击我" onclick="clicks()">

</div>

<script>


    /**
     ** @param isTrue ：为当前是否开关
     ** @param obj：    返回为当前JQ实例 使用obj.val()获取值
     **/
    var obj = $('.com-switch').comSwitch({
        callback:function(isTrue,obj){
            console.log(obj.val())
        }
    });
    //返回实例方法checked为一个数组
    function clicks(){
        console.log(obj.checked())
    }


</script>
</body>
</html>